'use strict';
/**
 * Created by zhouzhongyuan on 2016/1/12.
 */
$app.service(function (_) {
  return {
    formInlineMsg: function (data, status, clear) {
      _.isFunction(clear) && clear();
      if (_.isBoolean(status) && status == false) {
        status = "state-error";
      } else {
        status = "state-success";
      }
      if (status == undefined) {
        status = "state-error";
      }
      _.each(data, function (value) {
        if (_.isArray(value) && value.length == 2) {
          value[0].addClass(status);
          value[0].after('<em class="' + status + '">' + value[1] + '</em>');
        }
      })
    }
  };
});